// ***************************************************************************************
// Table 1: Determinants of industrial density (establishment employment over parcel size)
// ***************************************************************************************

// Writes the results as reg_parcel to $resultpath/tables/


use "$outpath/database_for_reg.dta", clear

eststo clear

global instruct "tdec(3) rdec(3) auto(3) bdec (3) symbol($^a$,$^b$,$^c$) se e(r2_p) tex label nocons"

xi: reghdfe Lnland_pwc Lnpopcma Lnareacma dist_min_NEW i.cat0 spacematep spacematep2 spacematep3 spacematep4 if samplep==1, absorb(naics4d eruid) cluster(cmauid)
outreg2 using "$resultpath/tables/reg_parcel.xls", replace $instruct

xi: reghdfe Lnland_pwc Lnpopcma Lnareacma dist_min_NEW i.cat0 spacematep spacematep2 spacematep3 spacematep4 Lnemp if samplep==1, absorb(naics4d eruid) cluster(cmauid)
outreg2 using "$resultpath/tables/reg_parcel.xls", append $instruct

xi: reghdfe Lnland_pwc Lnpopcma Lnareacma dist_min_NEW i.cat0 spacematep spacematep2 spacematep3 spacematep4 Lnemp i.hoffice i.exports NBdiffbusiness NBdiffnaics4 NBdiffproduct if samplep==1, absorb(naics4d eruid) cluster(cmauid)
outreg2 using "$resultpath/tables/reg_parcel.xls", append $instruct

xi: reghdfe Lnland_pwc Lnpopcma Lnareacma dist_min_NEW i.cat0 spacematep spacematep2 spacematep3 spacematep4 Lnemp i.hoffice i.exports NBdiffbusiness NBdiffnaics4 NBdiffproduct Lndist_maj_air Lndist_maj_sea Lndist_stat_freight Lndist_junction if samplep==1, absorb(naics4d eruid) cluster(cmauid)
outreg2 using "$resultpath/tables/reg_parcel.xls", append $instruct

xi: reghdfe Lnland_pwc Lnpopcma Lnareacma Lnda_density05 dist_min_NEW i.cat0 spacematep spacematep2 spacematep3 spacematep4 Lnemp i.hoffice i.exports NBdiffbusiness NBdiffnaics4 NBdiffproduct Lndist_maj_air Lndist_maj_sea Lndist_stat_freight Lndist_junction if samplep==1, absorb(naics4d eruid) cluster(cmauid)
outreg2 using "$resultpath/tables/reg_parcel.xls", append $instruct

global instruct "tdec(3) rdec(3) auto(3) bdec (3) symbol($^a$,$^b$,$^c$) se e(r2_p) tex label nocons stats(beta pval) "

xi: reg Lnland_pwc Lnpopcma Lnareacma dist_min_NEW i.cat0 i.naics4d i.eruid spacematep spacematep2 spacematep3 spacematep4 Lnemp i.hoffice i.exports NBdiffbusiness NBdiffnaics4 NBdiffproduct Lndist_maj_air Lndist_maj_sea Lndist_stat_freight Lndist_junction if samplep==1, beta ro
outreg2 using "$resultpath/tables/reg_parcel.xls", append $instruct keep(Lnpopcma Lnareacma Lnda_density05 dist_min_NEW _Icat0_2  _Icat0_3 _Ihoffice_2  _Iexports_2 spacematep spacematep2 spacematep3 spacematep4 Lnemp  NBdiffbusiness NBdiffnaics4 NBdiffproduct Lndist_maj_air Lndist_maj_sea Lndist_stat_freight Lndist_junction)

